package com.imooc.dynamic.my;

import com.imooc.annotation.DDS;
import com.imooc.annotation.DDSTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 */
@DDS("test_user")
@Service
public class MyUserServiceImpl implements MyUserService {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Autowired
    private MyOrderService myOrderService;

    @Override
    public void addUser(String username) {
        jdbcTemplate.update("insert into user(name) values(?)", username);
    }

    @Override
    public void addAll() {
        myOrderService.addOrder("新课java数据中台项目实战开发课程");
        addUser("http://www.imooc.com");
    }

    @Override
    public List queryList() {
        return jdbcTemplate.queryForList("select * from user");
    }
}
